package org.nepu.scr.indexrate.converter.drillingrate.keydevice.improvesystem;

import cn.hutool.json.JSONUtil;
import org.nepu.scr.indexrate.vo.drillingrate.keydevice.improvesystem.ImproveDevice;

import javax.persistence.AttributeConverter;
import javax.persistence.Convert;

@Convert
public class ImproveDeviceConverter implements AttributeConverter<ImproveDevice, String> {
    @Override
    public String convertToDatabaseColumn(ImproveDevice improveSystem) {
        return JSONUtil.toJsonStr(improveSystem);
    }

    @Override
    public ImproveDevice convertToEntityAttribute(String s) {
        return JSONUtil.toBean(s, ImproveDevice.class);
    }
}
